import KPlayer from './player'

export default class KPlayerGroup {
  /**
   * 获取正在游戏中的玩家.
   */
  static fromPlaying(): KPlayer[] {
    const camp = gameapi.get_camp_by_camp_id(1)
    const g = gameapi.get_role_ids_by_camp(camp)
    const num = globalapi.get_player_group_num(g)
    const list: KPlayer[] = []
    for (let i = 0; i <= num; i++) {
      const role = gameapi.get_role_by_int(i)
      if (role) {
        list.push(KPlayer.fromRole(role))
      }
    }
    return list
  }
}
